﻿using System.Data;
using Bosphorus.Migrator.Core;
using Bosphorus.Migrator.Core.MigrationCommand;
using Bosphorus.Migrator.Model;

namespace Bosphorus.Migrator.Facade.Demo.MigrationVersions
{
    public class VersionOne : IMigration
    {
        public ICommand Up()
        {
            return Database.Create<Table>("Table1")
                .Add<Column>("Column1", SqlDbType.Int, true)
                .Add<Column>("Column2", SqlDbType.VarChar, 30, false).Command;

            //return CommandBuilder.Build
            //    (
            //        Database.Create<Table>("Table1")
            //            .Add<Column>("Column1", SqlDbType.Int, true)
            //            .Add<Column>("Column2", SqlDbType.VarChar, 30, false),
            //        Database.Drop<Table>("Table1")
            //    );

            //return CommandBuilder.Build(
            //    Database.Create<Table>("MyTable").Add<Column>("Hede").Add<Column>("Hodo"),
            //    Database.Create<Table>("MyTable2").Add<Column>("Hede2").Add<Column>("Hodo2")
            //    );
        }

        public ICommand Down()
        {
            return Database.Drop<Table>("Table1").Command;
        }

        public int Version
        {
            get { return 1; }
        }
    }
}